/*    */ package com.feeyin.radar.sys.service.impl;
/*    */ 
/*    */ import com.feeyin.radar.commons.StringUtils;
/*    */ import com.feeyin.radar.sys.dao.ManageSetDAO;
/*    */ import com.feeyin.radar.sys.form.RepeatCustomerForm;
/*    */ import com.feeyin.radar.sys.model.ManageSet;
/*    */ import com.feeyin.radar.sys.model.ManageSetObject;
/*    */ import com.feeyin.radar.sys.service.RepeatCustomerSetService;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ 
/*    */ public class RepeatCustomerSetServiceImpl
/*    */   implements RepeatCustomerSetService
/*    */ {
/*    */   private ManageSetDAO manageSetDAO;
/*    */ 
/*    */   public ManageSetDAO getManageSetDAO()
/*    */   {
/* 23 */     return this.manageSetDAO;
/*    */   }
/*    */ 
/*    */   public void setManageSetDAO(ManageSetDAO manageSetDAO) {
/* 27 */     this.manageSetDAO = manageSetDAO;
/*    */   }
/*    */ 
/*    */   public RepeatCustomerForm getRepeatCustomerSets() {
/* 31 */     List manageSets = new ArrayList();
/* 32 */     List manageSetObjects = new ArrayList();
/*    */ 
/* 34 */     manageSets = this.manageSetDAO.getManageSetByType("5");
/*    */ 
/* 36 */     ManageSet manageSet = new ManageSet();
/* 37 */     if ((manageSets != null) && (manageSets.size() > 0)) {
/* 38 */       manageSet = (ManageSet)manageSets.get(0);
/* 39 */       if (manageSet != null) {
/* 40 */         manageSetObjects = this.manageSetDAO.getManageSetObjectByManageSetId(manageSet.getId());
/*    */       }
/*    */     }
/*    */ 
/* 44 */     if (manageSet == null) return null;
/* 45 */     RepeatCustomerForm repeatCustomerForm = new RepeatCustomerForm();
/* 46 */     repeatCustomerForm.setId(manageSet.getId());
/* 47 */     repeatCustomerForm.setIsRepeat(manageSet.getStatus());
/* 48 */     String recordIds = "";
/* 49 */     if (manageSetObjects != null) {
/* 50 */       for (int i = 0; i < manageSetObjects.size(); i++) {
/* 51 */         ManageSetObject manageSetObject = new ManageSetObject();
/* 52 */         manageSetObject = (ManageSetObject)manageSetObjects.get(i);
/* 53 */         recordIds = recordIds + manageSetObject.getOtherId() + ",";
/*    */       }
/*    */     }
/* 56 */     repeatCustomerForm.setRecordIds(recordIds);
/*    */ 
/* 58 */     return repeatCustomerForm;
/*    */   }
/*    */ 
/*    */   public boolean insertRepeatCustomerSet(String id, String isRepeat, String[] recordIds) {
/* 62 */     if (StringUtils.isEmpty(isRepeat)) return false;
/* 63 */     if (StringUtils.isEmpty(id)) return false;
/*    */ 
/* 65 */     ManageSet manageSet = new ManageSet();
/* 66 */     manageSet.setCode("repeateCustomer");
/* 67 */     manageSet.setMValue("0");
/* 68 */     manageSet.setStatus(isRepeat);
/* 69 */     this.manageSetDAO.updateManageSetByCode(manageSet);
/*    */ 
/* 71 */     this.manageSetDAO.deleteManageSetObject(Integer.valueOf(Integer.parseInt(id)));
/* 72 */     if ("0".equals(isRepeat)) {
/* 73 */       if (recordIds == null) return false;
/* 74 */       for (int i = 0; i < recordIds.length; i++) {
/* 75 */         ManageSetObject manageSetObject = new ManageSetObject();
/* 76 */         manageSetObject.setManageSetId(Integer.valueOf(Integer.parseInt(id)));
/* 77 */         manageSetObject.setOtherId(Integer.valueOf(Integer.parseInt(recordIds[i])));
/* 78 */         this.manageSetDAO.insertManageSetObject(manageSetObject);
/*    */       }
/*    */     }
/* 81 */     return true;
/*    */   }
/*    */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.service.impl.RepeatCustomerSetServiceImpl
 * JD-Core Version:    0.6.0
 */